//*****************************************************************************
// TITLE:         COLOR UTILITIES FOR GSB  
// DESCRIPTION:   defines color names and tools 
// AUTHOR:        Prof Jarek Rossignac
// DATE CREATED:  September 2009
// EDITS:
//*****************************************************************************
color col(int a, int r, int g, int b) {
  return a<<24 | r<<16 | g<<8 | b ;
} // makes color fast with alpha (opacity), red, green, blue between 0 and 255
color col(int r, int g, int b) {
  return r<<16 | g<<8 | b ;
} // makes color fast without alpha
color setA(color c, int a) {
  return (a<<24) | ((c<<8)>>8) ;
} // sets alpha for color c
int colA(color c) {
  return (c>>24) & 0xFF;
}
int colR(color c) {
  return (c>>16) & 0xFF;
}
int colG(color c) {
  return (c>>8) & 0xFF;
}
int colB(color c) {
  return c & 0xFF;
}
color interCol(color C0, float t, color C1) {
  return col( int((1.-t)*colA(C0)+t*colA(C1)), int((1.-t)*colR(C0)+t*colR(C1)), int((1.-t)*colG(C0)+t*colG(C1)), int((1.-t)*colB(C0)+t*colB(C1)) );
}
color brown=#8B5701, red=#FF0000, magenta=#FF00FB, blue=#0300FF, cyan=#00FDFF, green=#00FF01, yellow=#FEFF00, skin=#F5C7B7, black=#000000, grey=#868686, white=#FFFFFF, orange=#FFC000, metal=#BEC9E0;
color lbrown=#C19100, lred=#FF3E3E, lmagenta=#FF7EFD, lblue=#807EFF, lcyan=#7EFFFE, lgreen=#80FF7E, lyellow=#FFFF6C, lskin=#FFECE5, lorange=#FFDF7E;
color dbrown=#674001, dred=#810000, dmagenta=#81007F, dblue=#010081, dcyan=#008180, dgreen=#018100, dyellow=#B4B400, dskin=#815531, dorange=#E58F02;

// to set fixed random colors
color [] randomColor=new color[1000];   
void setRandomColors(int n) {
  for (int i=0; i<n; i++) randomColor[i]=color(int(random(255)), int(random(255)), int(random(255)));
}



